react 用 axios 打 localhost api server 出現 ERR_NETWORK 錯誤


將 express server 加上 cors 就好囉

npm install cors
import cors from 'cors';
app.use(cors({credentials:true}));
#React #Express #nodejs #cors #Axios






你可能感興趣的文章

一看就懂的 React 開發環境建置與 Webpack 入門教學

一看就懂的 React 開發環境建置與 Webpack 入門教學

LeetCode JS Easy 2704. To Be Or Not To Be

LeetCode JS Easy 2704. To Be Or Not To Be

Servlet接收前端Ajax傳遞的Json資料

Servlet接收前端Ajax傳遞的Json資料






留言討論